In a memory device comprising a controller and a magnetic memory which is controlled by the controller, there is a case where data read from the magnetic memory has an incorrect value because of a soft error or a hard error.
The soft error is an error which is due to an operating condition, and can be corrected by, for example, an error correction circuit (ECC). The hard error is an error caused by a defective cell generated in an initial period or because of deterioration with age, and recovery from the error can be achieved by, for example, redundancy replacement in which the defective cell is replaced with a redundancy cell. Also, data of a defective cell which cannot be replaced by redundancy replacement can be corrected by the ECC.
However, if the number of cells having a hard error exceeds a predetermined number, error correction cannot be executed even by redundancy replacement or ECC, as a result of which the magnetic memory is dealt with as a defective one.